package com.kim.net;

import java.io.IOException;

public abstract class NetPost implements NetBase {

	public NetEntity entity;
	protected NetCallback netCallback;

	public NetPost(NetEntity entity, NetCallback netCallback) {
		this.entity = entity;
		this.netCallback = netCallback;
	}

	public final void sendEntity() {
		entity.initHttpHeader();
		send();
	}

	/**
	 * 发送消息，并将消息返回
	 * 
	 * @return
	 * 
	 */
	protected abstract void send();

	/**
	 * 捕获异常
	 * 
	 * @param ex
	 * @return
	 * 
	 */
	protected abstract void catchException(IOException ex);
}
